/**
 * FeedbackController
 *
 * 主要职责：
 * - 提交用户反馈、管理员查看并回复反馈
 *
 * 关键接口示例：
 * - Response submitFeedback(FeedbackDto dto)
 *
 * 依赖项：
 * - IFeedbackService、EmailService（通知）
 *
 * 答辩要点：
 * - 反馈的隐私保护与处理流程
 */
package net.zjitc.yqmusicserver.controller;

import jakarta.annotation.Resource;
import net.zjitc.yqmusicserver.domain.Feedback;
import net.zjitc.yqmusicserver.domain.dto.FeedbackDTO;
import net.zjitc.yqmusicserver.result.PageResult;
import net.zjitc.yqmusicserver.result.Result;
import net.zjitc.yqmusicserver.service.IFeedbackService;
import org.springframework.web.bind.annotation.*;


import java.util.List;

/**
*@author 罗翼侨
*@date 2025/6/18 09:44
*/
@RestController
public class FeedbackController {
    @Resource
    private IFeedbackService feedbackService;

    /**
     * 获取反馈列表
     *
     * @return 反馈列表
     */
    @PostMapping("/admin/getAllFeedbacks")
    public Result<PageResult<Feedback>> getAllFeedbacks(@RequestBody FeedbackDTO feedbackDTO) {
        return feedbackService.getAllFeedbacks(feedbackDTO);
    }

    /**
     * 删除反馈
     *
     * @param feedbackId 反馈id
     * @return 结果
     */
    @DeleteMapping("/admin/deleteFeedback/{id}")
    public Result deleteFeedback(@PathVariable("id") Long feedbackId) {
        return feedbackService.deleteFeedback(feedbackId);
    }

    /**
     * 批量删除反馈
     *
     * @param feedbackIds 反馈id列表
     * @return 结果
     */
    @DeleteMapping("/admin/deleteFeedbacks")
    public Result deleteFeedbacks(@RequestBody List<Long> feedbackIds) {
        return feedbackService.deleteFeedbacks(feedbackIds);
    }

    /**
     * 添加反馈
     *
     * @param content 反馈内容
     * @return 结果
     */
    @PostMapping("/feedback/addFeedback")
    public Result addFeedback(@RequestParam(value = "content") String content) {
        return feedbackService.addFeedback(content);
    }

}
